package tech.aistar.corejava.day05.HomeWork.Dating;

/**
 * Created by 李雨昂 on 2019/7/20.
 */
public class Compare {
    //判断两个person对象是否满足结婚条件
    public static String isMarry(Person person1, Person person2){
        if("未婚".equals(person1.getMarriage()) && "未婚".equals(person2.getMarriage())){
            if( !person1.getSex().equals(person2.getSex())){
                if(("男".equals(person1.getSex()) && person1.getAge() >= 24 && person2.getAge() >= 22) || (("男".equals(person2.getSex()) && person2.getAge() < 24 && person1.getAge() < 22))){
                    return "能结婚";
                }
            }
        }
        return "不能结婚";
    }

}
